<template>
	<view class="mainpadding">
		<view class="mainpadding ffffff flexbetween" @click="xzshow=true">
			<view class="titletext xiaohei margin_right3">险种</view>
			<view class="flexright">
				<input class="titletext textright flex1" type="text" placeholder="请选择险种" disabled=""
					v-model="user_gb_xz_name">
				<u-icon name="arrow-right" color="#999" size="16"></u-icon>
			</view>
		</view>
		<view class="posibottom mainpadding">
			<view class="submitbtn" @click="submit">确定</view>
		</view>
		<u-picker :show="xzshow" :columns="xzcolumns" title="" @cancel="xzshow=false" @confirm="xzconfirm"
			keyName="name"></u-picker>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				xzcolumns: [],
				xzshow: false,
				user_gb_xz_id: "",
				user_gb_xz_name: "",
			}
		},
		onLoad() {
			this.getxz()
		},
		methods: {
			submit(){
				if(this.user_gb_xz_id==""){
					httpRequest.toast("请选择险种")
					return false
				}
				if(this.user_gb_xz_id==5){
					uni.navigateTo({
						url:"/pages/tab4/goubaogs?id="+this.user_gb_xz_id+"&name="+this.user_gb_xz_name
					})
				}else{
					uni.navigateTo({
						url:"/pages/tab4/goubao?id="+this.user_gb_xz_id+"&name="+this.user_gb_xz_name
					})
				}
			},
			getxz() {
				httpRequest.request('/api/user/userGbXzIndex', 'GET', {}).then(res => {
					this.xzcolumns.push(res.data)
				})
			},
			xzconfirm(e) {
				this.user_gb_xz_name = e.value[0].name
				this.user_gb_xz_id = e.value[0].id
				this.xzshow = false
			},
		}
	}
</script>

<style lang="scss" scoped>

</style>
